<template>
  <a-config-provider :theme="theme" :locale="zhCN">
    <router-view />
  </a-config-provider>
</template>

<script lang="ts" setup>
import useSettingTheme from '@/store/settingTheme'
import zhCN from 'ant-design-vue/es/locale/zh_CN'

import dayjs from 'dayjs'

import 'dayjs/locale/zh-cn'

const themeStore = useSettingTheme()

dayjs.locale('zh-cn')

const theme = computed(() => ({ token: themeStore.theme }))
watchEffect(() => {
  if (themeStore.theme) {
    const bodyEle: HTMLBodyElement = document.querySelector('body') as HTMLBodyElement
    bodyEle?.setAttribute('style', `--current-color: ${themeStore.theme}; --current-bg: ${themeStore.bgColor}`)
  }
})
</script>

<style lang="less">
:deep(.ant-modal) {
  & > div[aria-hidden='true'] {
    display: none !important;
  }
}
</style>
